<template>
  <van-nav-bar :left-arrow="leftArrow"
               :fixed="fixed"
               :z-index="zIndex"
               @click-left="onClickLeft"
               @click-right="onClickRight"
  >
    <van-icon slot="left" class="iconfont icon_back" color="#333333" size="18"><span class="main-title margin-left-10">{{title}}</span></van-icon>
<!--    <div  slot="title"><div class="main-title">{{title}}</div></div>-->
    <van-icon slot="right" name="ellipsis" color="#333333" size="22"></van-icon>
  </van-nav-bar>
</template>

<script>
  export default {
    name: 'header-back',
    props: ['title', 'leftArrow','fixed'],
    data:function () {
        return{
          zIndex:5
        }
    },
    methods:{
      onClickLeft() {
        console.log('返回上一级');
        this.$router.back(-1)
      },
      onClickRight() {
        //调用父组件的这个方法
        this.$emit('onClickRight');
      }
    }
  }
</script>

<style scoped>

</style>
